#ifndef AES_GCM_H
#define AES_GCM_H
#include <iostream>
#include<string.h>
#include<openssl/aes.h>
#include<openssl/rsa.h>
#include<openssl/pem.h>
#include<openssl/err.h>
#include<qstring.h>
#include<QDebug>
#include <openssl/bio.h>
#include <openssl/evp.h>
/* AES-GCM test data from NIST public test vectors */
class aes_gcm
{
public:
    aes_gcm(unsigned char* key);
    unsigned char *gcm_key;
    unsigned char *gcm_iv;
    unsigned char *gcm_pt;
    unsigned char *gcm_aad;
    unsigned char *gcm_ct;
    unsigned char *gcm_tag;
    unsigned char outbuf[1024];
    int gcm_pt_len;//明文长度
    int gcm_ct_len;//密文长度
    QString input1;
    QString output2;
    QByteArray output1;
    QByteArray input2;
    QString fromchartostring(unsigned char c[],int n);
    QString fromchartostring2(unsigned char c[],int n);
    void aes_gcm_encrypt();
    void aes_gcm_decrypt();
    void aes_encrypt();//AES加密,输入QString，输出QByteArrqy
    void aes_decrypt();//AES解密，输入QByteArrqy，输出QString
    unsigned char* getgcmchar(unsigned char  c[],int n);//分配长度为n动态char数组r，将数组c内容倒入r
};

#endif // AES_GCM_H
